Skip to content

Conversation

@B-Rosenbaum
Copy link

No description provided.

Copy link
Owner

@gemtechd gemtechd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments and work further on the task

throw new Error("n is not valid!")
}
if ((!(point1 instanceof Point)) || (!(point2 instanceof Point))) {
throw new Error("the object not instance of 'Point'!")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which point is not correct?

constructor({x=0, y=0}={}) {
constructor({ x = 0, y = 0 } = {}) {
if(typeof(x)!=="number" || typeof(y)!=="number" ){
throw new Error('argument is not a number!')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which parameter is not correct


const calculateDistance = (point1, point2) => {
if(point1===undefined || point2===undefined ){
throw new Error('the function must get an arguments!')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which argument is missing?

}
if((!(line1 instanceof Line))||(!(line2 instanceof Line))){
throw new Error("the arguments is not instance of 'Line'!")
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which argument?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't throw an error: You can calculate it

if((!(line1 instanceof Line))||(!(line2 instanceof Line))){
throw new Error("the arguments is not instance of 'Line'!")
}
if (line1.slope === line2.slope) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if the slope is still undefined or the n is still undefined?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't throw an error: You can calculate it

describe('RETURN_THE_POINT_ON_X_ASIS', () => {
it('should return the slope', () => {
line.getPointOnXAsis()
expect(line.getPointByY(2)).toEqual({ x: 1, y: 2 })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are checking the getPointOnXAsis
your expect a result from a different function - getPointbyY
and the description is about something totally different...

describe('RETURN_THE_POINT_ON_Y_ASIS', () => {
it('', () => {
line.getPointOnYAsis()
expect(line.getPointByX(2)).toEqual({ x: 2, y: 3 })
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the description of the test?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing test descriptions
Where are the mocks?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm waiting to see the mocks

Copy link
Owner

@gemtechd gemtechd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments
Build mocks in the tests

@@ -6,16 +6,32 @@ let line = new Line({ point1, point2 })
let line1 = new Line({ point1, point2 })
const myline = new Line({})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't declare all parameters before the tests
do it inside each test apart

describe('MOVE_VERTICAL', () => {
describe('POINT_CONSTRUCTOR', () => {
it('should check the point object', () => {
expect(mypoint.x).toBe(0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare the parameters inside each test

let line4 = new Line({ point5, point6, slope: 1, n: 0 })
let line5 = new Line({ point5, point4, slope: 1, n: 3 })
let line6 = new Line({ point5, point4, slope: 1, n: 3 })

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't declare parameters in the head of the module, each test gets its own object to test on it

let line6 = new Line({ point5, point4, slope: 1, n: 3 })

describe('CALCULATE_DISTANCE', () => {
it('return the sqrt for distance to point1 with point2', () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the description should be: should return the distance between two points. No need to explain the calculation

it('', () => {
expect(calculateJunctionPoint(line1,line1)).toBe(true)
it('should return true if the slope and the n equal in line1 and line2', () => {
expect(calculateJunctionPoint(line1, line1)).toBe(true)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return true when both lines are the same

expect(calculateJunctionPoint(line1,line2)).toBe(false)

it('should return false if the slope equal and the n not in line1 and line2', () => {
expect(calculateJunctionPoint(line1, line2)).toBe(false)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should return false if both lines are parallel

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm waiting to see the mocks

}
if((!(line1 instanceof Line))||(!(line2 instanceof Line))){
throw new Error("the arguments is not instance of 'Line'!")
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't throw an error: You can calculate it

if((!(line1 instanceof Line))||(!(line2 instanceof Line))){
throw new Error("the arguments is not instance of 'Line'!")
}
if (line1.slope === line2.slope) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't throw an error: You can calculate it

@B-Rosenbaum
Copy link
Author

B-Rosenbaum commented Jul 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants